import request from '@/utils/request'

// 获得未审核状态的帖子
export function fetchUnAuditedList(query) {
  return request({
    baseURL: process.env.VUE_APP_ADMIN_API,
    url: '/post/unauditedpost',
    method: 'get',
    params: query
  })
}

// 获得全部审核状态的帖子
export function fetchAllPostList(query) {
  return request({
    baseURL: process.env.VUE_APP_ADMIN_API,
    url: '/post/allpost',
    method: 'get',
    params: query
  })
}

// 获得指定ID帖子内容
export function fetchPost(id) {
  return request({
    baseURL: process.env.VUE_APP_ADMIN_API,
    url: '/post/detail',
    method: 'get',
    params: { id }
  })
}

// 帖子敏感词汇检索
export function retrieveSensitiveWord(id) {
  return request({
    baseURL: process.env.VUE_APP_ADMIN_API,
    url: '/post/retrieval',
    method: 'get',
    params: { id }
  })
}

// 通过帖子
export function pass(id) {
  return request({
    baseURL: process.env.VUE_APP_ADMIN_API,
    url: '/post/pass',
    method: 'get',
    params: { id }
  })
}

// 驳回帖子
export function reject(id) {
  return request({
    baseURL: process.env.VUE_APP_ADMIN_API,
    url: '/post/reject',
    method: 'get',
    params: { id }
  })
}

export function fetchPv(pv) {
  return request({
    url: '/vue-element-admin/article/pv',
    method: 'get',
    params: { pv }
  })
}

export function createArticle(data) {
  return request({
    url: '/vue-element-admin/article/create',
    method: 'post',
    data
  })
}

export function updateArticle(data) {
  return request({
    url: '/vue-element-admin/article/update',
    method: 'post',
    data
  })
}
